<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>北京航天公司固定资产管理系统</title>
</head>
<body>
<div th:if="${session.userInfo.rname}=='部门经理'" style="display: inline;">
    <div class="layui-btn-container" th:if="${fbo.status == '0' || fbo.status == '4' || fbo.status == '5'}">
        <button class="layui-btn  layui-btn-danger" onclick="approval()" >审核拒绝</button>
        <button class="layui-btn"  onclick="approvals()" >审核通过</button>
        <input type="hidden" name="borrow_id" th:value="${fbo.borrow_number}">
        <input type="hidden" name="pass_id" th:value="4">
        <input type="hidden" name="turn_id" th:value="5">
    </div>
</div>
<div th:if="${session.userInfo.rname}=='财务部经理'" style="display: inline;">
    <div class="layui-btn-container" th:if="${fbo.status == '4'}">
        <button class="layui-btn  layui-btn-danger" onclick="approval()" >审核拒绝</button>
        <button class="layui-btn"  onclick="approvals()" >审核通过</button>
        <input type="hidden" name="borrow_id" th:value="${fbo.borrow_number}">
        <input type="hidden" name="pass_id" th:value="7">
        <input type="hidden" name="turn_id" th:value="8">
    </div>
</div>
<!--<div class="layui-btn-container" th:if="${session.userInfo.type}=='系统管理员'" style="display: inline;">-->
<!--    <button class="layui-btn  layui-btn-danger" onclick="approval()" >审核拒绝</button>-->
<!--    <button class="layui-btn"  onclick="approvals()" >审核通过</button>-->
<!--    <input type="hidden" name="borrow_id" th:value="${fbo.borrow_number}">-->
<!--    <input type="hidden" name="pass_id" th:value="4">-->
<!--    <input type="hidden" name="turn_id" th:value="5">-->
<!--</div>-->
<!--<div class="layui-btn-container" th:if="${session.userInfo.type}=='普通员工'" style="visibility: hidden;">-->
<!--    <button class="layui-btn  layui-btn-danger" onclick="approval()" >审核拒绝</button>-->
<!--    <button class="layui-btn"  onclick="approvals()" >审核通过</button>-->
<!--    <input type="hidden" name="borrow_id" th:value="${fbo.borrow_number}">-->
<!--    <input type="hidden" name="pass_id" th:value="4">-->
<!--    <input type="hidden" name="turn_id" th:value="5">-->
<!--</div>-->
<div class="layui-inline">
    <div class="layui-col-xs6 layui-col-md4">
        <blockquote class="layui-elem-quote" style="width: 1550px;">借用信息详情</blockquote><br>
    </div>
</div>
<!--<nav>-->
<!--    <button class="layui-btn">资产借用</button>-->
<!--    <button class="layui-btn">提报历史</button><br>-->
<!--</nav>-->
<form action="javascript:void(0)" class="layui-form layui-form-pane">


    <div class="layui-form-item" >
        <div class="layui-inline" >
            <label class="layui-form-label">所属组织</label>
            <div class="layui-input-inline">
                <input type="hidden" name="id" th:value="${fbo.borrow_number}">
                <input type="tel" name="phone" readonly lay-verify="required|phone" th:value="${fbo.sum_dname}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">所属部门</label>
            <div class="layui-input-inline">
                <input type="text" name="email" th:if="${session != null}" readonly lay-verify="email" th:value="${fbo.dname}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">责任人</label>
            <div class="layui-input-inline">
                <input type="tel" name="phone" readonly lay-verify="required|phone" th:value="${fbo.admin}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">借用日期</label>
            <div class="layui-input-inline">
                <input type="text" name="email" readonly lay-verify="email" autocomplete="off" th:value="${fbo.drawing_time}" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item" >
        <div class="layui-inline">
            <label class="layui-form-label">归还日期</label>
            <div class="layui-input-inline">
                <input type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" th:value="${fbo.return_time}" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">审批状态</label>
            <div class="layui-input-inline">
                <span th:if="${fbo.status == '0'}">
                    <input th:value="未审批" type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" class="layui-input">
                </span>
                <span th:if="${fbo.status == '1'}">
                    <input th:value="借用中" type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" class="layui-input">
                </span>
                <span th:if="${fbo.status == '2'}">
                    <input th:value="已借用" type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" class="layui-input">
                </span>
                <span th:if="${fbo.status == '3'}">
                    <input th:value="借用终止" type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" class="layui-input">
                </span>
                <span th:if="${fbo.status == '4'}">
                    <input th:value="部門经理审批成功" type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" class="layui-input">
                </span>
                <span th:if="${fbo.status == '5'}">
                    <input th:value="部門经理审批失败" type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" class="layui-input">
                </span>
                <span th:if="${fbo.status == '7'}">
                    <input th:value="财务经理审批成功" type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" class="layui-input">
                </span>
                <span th:if="${fbo.status == '8'}">
                    <input th:value="财务经理审批失败" type="tel" name="phone" readonly lay-verify="required|phone" autocomplete="off" class="layui-input">
                </span>
            </div>
        </div>

    </div>
    <div class="layui-inline">
        <div class="layui-col-xs6 layui-col-md4">
            <blockquote class="layui-elem-quote" style="width: 1550px;">借用申请说明</blockquote><br>
        </div>
    </div>
    <div class="layui-form-item layui-form-text" >
        <label class="layui-form-label">申请说明</label>
        <div class="layui-input-block">
            <textarea placeholder="" readonly th:value="${fbo.purpose}" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-collapse" lay-filter="test">
        <div class="layui-colla-item">
            <h2 class="layui-colla-title">借用的详细信息</h2>
            <div class="layui-colla-content">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>资产编号</th>
                        <th>资产名称</th>
                        <th>资产负责人</th>
                        <th>资产所属部門</th>
                    </tr>
                    </thead>
                    <tboby>
                        <tr th:each="b : ${bN}">
                            <td th:text="${b.property_id}"></td>
                            <td th:text="${b.property_name}"></td>
                            <td th:text="${b.property_principal}"></td>
                            <td th:text="${b.dname}"></td>
                        </tr>
                    </tboby>
                </table>
            </div>
        </div>
    </div>


</form>

</body>
</html>
<script type="text/javascript"  src="/js/jquery-1.8.2.js"></script>
<script type="text/javascript"  src="/js/layer.js"></script>
<script type="text/javascript"  src="/layui/layui.all.js" ></script>
<link rel="stylesheet" href="/layui/css/layui.css">
<script type="text/javascript">
    var form=layui.form;
    $(function () {
        form.render();


        //初始化  时间控件
        var laydate=layui.laydate;
        laydate.render({
            elem: '#appDate', //指定元素
            type:'date',
        })
    })

    // // 拒绝
    function approval() {
        var borrow_id = $("input[name='borrow_id']").val();
        var turn_id = $("input[name='turn_id']").val();
            $.post("/borrow/getIsPsaa?borrow_number="+borrow_id+"&status="+turn_id,function (res) {
                if(res >0){
                    // alert("拒绝成功")
                    // location.href="/jump/goBorrowIndex";
                    layer.alert("拒绝成功")
                    setTimeout(function () {
                        location.href="/jump/goBorrowIndex";
                    },2000)
                }
            })
    }
    // 通过
    function approvals() {
        var borrow_id = $("input[name='borrow_id']").val();
        var pass_id = $("input[name='pass_id']").val();
        $.post("/borrow/getIsPsaa?borrow_number="+borrow_id+"&status="+pass_id,function (res) {
            if(res >0){
                // alert("通过成功")
                // location.href="/jump/goBorrowIndex";
                layer.alert("通过成功")
                setTimeout(function () {
                    location.href="/jump/goBorrowIndex";
                },2000)
            }
        })


    }
</script>
